Module - 3: Combinational Logic Circuits
On completion of this module, you will be able to:
- Understand Arithmatic operation
- Understand 1's and 2's complement
- Understand half substration and full substration
- Understand Parallel and Serial Adder
- Understand combinational logic circuits
- Understand Encoder and Decoder
- Understand Multiplexer and Demultiplexer
Arithmetic Circuits
- Arithmetic Circuits are nothing but the logic circuits, which is used to complete some Arithmetic Functions like addition, subtraction, multiplication, division, parity calculation etc.
- Arithmetic Logic Circuits are always a combinational logic circuits because the output is totally depending on the current input not depends on the previous inputs and outputs.
- Addition and Subtraction are two basic Arithmetic Operations that must be performed by any Digital Computer.
- If both these operations can be properly implemented, then Multiplication and Division tasks become easy (as multiplication is repeated addition and division is repeated subtraction).
Binary Addition
- The binary number system uses only two digits 0 and 1 due to which their addition is simple. There are four basic operations for binary addition, as mentioned below.
1. 0 + 0 = 0
2. 0 + 1 = 1
3. 1 + 0 = 1
4. 1 + 1 = 10
- The above first three equations are very identical to the binary digit number. The addition is carried out column by column in details is shown below.
- Let us consider the addition of 11101 and 11011.
- The above sum is carried out by following step
1 + 1 = 10 = 0 with a carry of 1
1 + 0 + 1 = 10 = 0 with a carry of 1
1 + 1 + 0 = 10 = 10 = 0 with a carry of 1
1 + 1 + 1 = 10 + 1 = 11 = 1 with a carry of 1
1 +1 +1 = 11
- Note:- carefully that 10 + 1 = 11, which is equivalent to two + one = three (the next binary number after 10). Thus, the required result is 111000.
Binary Subtraction
- Another basic arithmetic operation to be performed by Digital Computers is the Subtraction.
- Subtraction is a mathematical operation in which one integer number is deducted from another to obtain the equivalent quantity.
- The number from which other number is to be deducted is called as Minuend and the number subtracted from the minuend is called Subtrahend.
- Similar to the binary addition, binary subtraction is also having four possible basic operations. They are:
1. 0 − 0 = 0
2. 1 − 0 = 1
3. 1 − 1 = 0
4. 10 − 1 = 1
- The above first three operations are easy to understand as they are identical to decimal subtraction. The fourth operation can be understood with the logic two minus one is one.
- For a binary number with two or more digits, the subtraction is carried out column by column as in decimal subtraction.
- Also, sometimes one has to borrow from the next higher column. Consider the following example.
- The above subtraction is carried out through the following steps.
0 − 0 = 0
For 0 − 1 = 1, taking borrow 1 and then 10 − 1 = 1
For 1 − 0, since 1 has already been given, it becomes 0 − 0 = 0
1 − 1 = 0
- Therefore, the result is 0010.
Signed and Unsigned Binary Numbers
- The integer variables are represented in a signed and unsigned manner. The positive and negative values are differentiated by using the sign flag in signed numbers. The unsigned numbers do not use any flag for the sign, i.e., only positive numbers can be stored by the unsigned numbers.
- It is very easy to represent positive and negative numbers in our day to day life. We represent the positive numbers without adding any sign before them and the negative number with - (minus) sign before them. But in the digital system, it is not possible to use negative sign before them because the data is in binary form in digital computers. For representing the sign in binary numbers, we require a special notation.
Signed Numbers
- The signed numbers have a sign bit so that it can differentiate positive and negative integer numbers. The signed binary number technique has both the sign bit and the magnitude of the number. For representing the negative decimal number, the corresponding symbol in front of the binary number will be added.
- The signed numbers are represented in three ways.
- Sign-Magnitude form : - In this form, a binary number has a bit for a sign symbol. If this bit is set to 1, the number will be negative else the number will be positive if it is set to 0. Apart from this sign-bit, the n-1 bits represent the magnitude of the number.
- 1's Complement :- By inverting each bit of a number, we can obtain the 1's complement of a number. The negative numbers can be represented in the form of 1's complement. In this form, the binary number also has an extra bit for sign representation as a sign-magnitude form.
- 2's Complement :- By inverting each bit of a number and adding plus 1 to its least significant bit, we can obtain the 2's complement of a number. The negative numbers can also be represented in the form of 2's complement. In this form, the binary number also has an extra bit for sign representation as a sign-magnitude form.
1's and 2's complement
- In number representation techniques, the binary number system is the most used representation technique in digital electronics.
- The complement is used for representing the negative decimal number in binary form. Different types of complement are possible of the binary number, but 1's and 2's complements are mostly used for binary numbers.
- We can find the 1's complement of the binary number by simply inverting the given number.
- For example, 1's complement of binary number 1011001 is 0100110.
- We can find the 2's complement of the binary number by changing each bit(0 to 1 and 1 to 0) and adding 1 to the least significant bit. For example, 2's complement of binary number 1011001 is (0100110)+1=0100111.
- Example 1: 11010.1101
For finding 1's complement of the given number, change all 0's to 1 and all 1's to 0. So the 1's complement of the number 11010.1101 comes out 00101.0010.
- Example 2: 100110.1001
For finding 1's complement of the given number, change all 0's to 1 and all 1's to 0. So, the 1's complement of the number 100110.1001 comes out 011001.0110.
- Example 3: 110100
For finding 2's complement of the given number, change all 0's to 1 and all 1's to 0. So the 1's complement of the number 110100 is 001011. Now add 1 to the LSB of this number, i.e., (001011)+1=001100.
- Example 4: 100110
For finding 1's complement of the given number, change all 0's to 1 and all 1's to 0. So, the 1's complement of the number 100110 is 011001. Now add one the LSB of this number, i.e., (011001)+1=011010.
9's and 10's Complement
- If the number is binary, then we use 1's complement and 2's complement. But in case, when the number is a decimal number, we will use the 9's and 10's complement.
- The 10's complement is obtained from the 9's complement of the number, and we can also find the 9's and 10's complement using the r's and (r-1)'s complement formula.
9's Complement
- The 9's complement of a number is calculated by subtracting each digit of the number by 9.
- For example, suppose we have a number 1423, and we want to find the 9's complement of the number.
- For this, we subtract each digit of the number 1423 by 9. So, the 9's complement of the number 1423 is 9999-1423= 8576.
10's Complement
- The 10's complement of a number is calculated by subtracting each digit by 9 and then adding 1 to the result.
- Simply, by adding 1 to its 9's complement we can get its 10's complement value.
- For example, suppose we have a number 1423, and we want to find the 10's complement of the number.
- For this, we find the 9's complement of the number 1423 that is 9999-1423= 8576, and now we will add 1 to the result.
- So, the 10's complement of the number 1423 is 8576+1=8577.
Subtraction of Binary Number using 1's Complement
- Subtraction of a binary number from another can be accomplished by adding the complement of the subtrahend to the minuend.
- Subtraction of a binary number using the 1's complement method allows subtraction only by addition.
- The 1's complement of a binary number can be obtained by changing all 1s to 0s and all 0s to 1s.
- To subtract a smaller number from a larger number, the 1's complement method is as follows:
- Determine the 1’s complement of the smaller number.
- Add this to the larger number.
- Remove the carry and add it to the result. This carry is called end-around-carry.
- Example: Subtract (1010)2 from (1111)2 using 1’s complement method.
- Find the 1’s complement of 1010. It will be found by replacing all 0 to 1 and all 1 to 0. In this way, the required 1’s complement will be 0101.
- In this step, we need to add the vale calculated in step-1 to 1111. This is shown below.
- For your reference, addition of binary digits 1 + 1 = 10. Also, note that carry 1 has been added to the addition to get the subtraction of the binary numbers. Thus, the subtraction is done by actually adding two binary numbers..
- To subtract a Larger Number from Smaller Number, the 1's complement method is as follows:
- Determine the 1’s complement of the larger number.
- Add this to the smaller number.
- The answer is the 1’s complement of the true result and opposite in sign. There is no carry..
- Example: Subtract (1010)2 from (1000)2 using 1’s complement method.
- The 1’s complement of (1010)2 is (0101)2. Now, we will add this with the smaller number and finally take 1’s complement of the result to get the answer. This is shown below.
Subtraction of Binary Number using 2's Complement
- Subtraction of a binary number from another can be accomplished by adding the complement of the subtrahend to the minuend.
- Subtraction of a binary number using the 1's complement method allows subtraction only by addition.
- The 1's complement of a binary number can be obtained by changing all 1s to 0s and all 0s to 1s.
- To subtract a smaller number from a larger number, the 2's complement method is as follows:
- Determine the 2’s complement of the smaller number.
- Add this to the larger number.
- Remove the carry. Note that, there is always a carry in this case.
- Example: Subtract (1010)2 from (1111)2 using 2’s complement method.
- Find the 2’s complement of (1010)2. Which is (0110)2 .
- After that, we need to add the (0110)2 to (1111)2. This is shown below.
- To subtract a Larger Number from Smaller Number, using 2's complement method is as follows:
- Determine the 2’s complement of the larger number.
- Add this to the smaller number.
- There is no carry in this case. The result is in 2's complement form and is negative.
- To get answer in true form, take 2's complement and change its sign.
- Example: Subtract (1010)2 from (1000)2 using 2’s complement.
- Find the 2’s complement of (1010)2. It is (0110)2. Now add (0110)2 to (1000)2. This is shown below.
Combinational Logic circuits
- The combinational logic circuits are the circuits that contain different types of logic gates. Simply, a circuit in which different types of logic gates are combined is known as a combinational logic circuit.
- The output of the combinational circuit is determined from the present combination of inputs, regardless of the previous input. The input variables, logic gates, and output variables are the basic components of the combinational logic circuit.
- There are different types of combinational logic circuits, such as Adder, Subtractor, Decoder, Encoder, Multiplexer, and De-multiplexer.
- There are the following characteristics of the combinational logic circuit:
- At any instant of time, the output of the combinational circuits depends only on the present input terminals.
- The combinational circuit doesn't have any backup or previous memory. The present state of the circuit is not affected by the previous state of the input.
- The n number of inputs and m number of outputs are possible in combinational logic circuits.
- The n input variable comes from the external source while the m output variable goes to the external destination. In many applications, the source or destinations are storage registers.
Half Subtractors
- A Half Subtractor is a multiple output Combinational Logic Circuit that does the subtraction of two 1-bit binary numbers.
- It has two inputs and two outputs. The two inputs correspond to the two 1-bit binary numbers and the two outputs corresponds to the Difference bit and Borrow bit (in contrast to Sum and Carry in Half Adder).
- Truth table and logic circuit of a half Subtractor is shown below.
Full Subtractor
- Full Subtractor is a combinational logic circuit which performs a subtraction between the two 1-bit binary numbers and it also considers the borrow of the previous bit i.e., whether 1 has been borrowed by the previous minuend bit.
- So, a Full Subtractor has three inputs, in which two inputs corresponding to the two bits to be subtracted (minuend A and subtrahend B), and a borrow bit, usually represented as BIN, corresponding to the borrow operation. There are two outputs, one corresponds to the difference D output and the other Borrow output BO.
- Truth table and logic circuit of a Full Subtractor is shown below.
Encoder
- An Encoder is a combinational logic circuit that performs the reverse operation of Decoder. It has maximum of 2n input lines and n output lines.
- It will produce a binary output code depending on which of its inputs are activated. Therefore, the encoder encodes 2n input lines with n bits.
4 to 2 Encoder
- It has four inputs let Y3, Y2, Y1, Y0 and two outputs A1 and A0 .
- The block diagram of 4 to 2 Encoder is shown in the following figure.
- At any time, only one of these 4 inputs can be ‘1’ in order to get the respective binary code at the output. The Truth table of 4 to 2 encoder is shown below.
- From the above Truth table, we can write the Logical expression for A1 and A0 :
A1 = Y3 + Y2
A0 = Y3 + Y1
- We can implement the above two Boolean functions by using two input OR gates. The circuit diagram of 4 to 2 encoder is shown in the following figure.
Octal to Binary Encoder(8:3)
- This encoder converts octal numbers to binary. It has eight input lines from Y7 to Y0 and three outputs lines A2, A1 and A0 .
- The circuit allows only one of the input lines to be activated at any given time, so there are only eight possible input combinations.
- It is designed so that it generate 3 bit binary code that corresponds to the input lines that is activated.
- The block diagram of 8 to 3 Encoder is shown in the following figure.
- At any time, only one of these 8 inputs can be 1 in order to get the respective binary code at the output. The Truth table of 8 to 3 encoder is shown below.
- From the above Truth table, we can write the Logical expression for A2, A1 and A0 :
A2 = Y7 + Y6 + Y5 + Y4
A1 = Y7 + Y6 + Y3 + Y2
A0 = Y7 + Y5 + Y3 + Y1
- We can implement the above three Boolean functions by using fourinput OR gates. The circuit diagram of 8 to 3 encoder is shown in the following figure.
Decoder
- Decoder is a combinational circuit that converts binary information from n input lines to a maximum of 2n output lines.
- Decoder is a logic circuit which performs the opposite action of the Encoder.
- If the n -bit decoded information has unused or dont't care conditions, the decoder may have fewer than 2n outputs.
- The output indicates the presence or absence of specific number at the decoder input.
- Decoders are used whenever an output or group of outputs is to be activated only on occurance of specific input combination.
- An Decoder has ninput lines and output 2n lines.Block diagram of decoder is shown below:
2 to 4 Decoder
- It has has two input lines let A and B and four output lines Q3, Q2, Q1 and Q0
- A block diagram of 2 to 4 binary decoder decoder is shown below. The truth table shows that for any given input combination exactly one output will turn to 1.
- The 2 to 4 line binary decoder shown below consists of an array of four AND gates. The 2 binary inputs represented as A and B are decoded into one of four outputs.
- From the above Truth table, we can write the Logical expression for Q3, Q2, Q1 and Q0 :
Q3 = A'B'
Q2 = A'B
Q1 = AB'
Q0 = AB
- We can implement the above four Boolean functions by using two input NAND gates and NOT gates. The circuit diagram of 2 to 4 Decoder is shown in the following figure.
Applictions
- Decoders are widely used in the memory system of computer
- BCD to 7-Segment Decoder
- BCD to Decimal Decoder
- Excess-3 (Gray) to Decimal Decoder
- 8-bit Priority Encoder
- Binary to 2 of 8 Decoder
- 16-Key Encoder Decoder
- BCD to Binary and Vice-Versa Decoder
- Manchester Code Encoder and Decoder